package cn.yunhe.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;


@Entity(name = "用户")
@Table(name = "user1")
public class User implements Serializable {
   private int id;
   private String loginid;
   private String loginpwd;
   private String name;
   private String phone;

   private Set<Order> orderSet=new HashSet<>();

    public User() {
    }


    public User(String loginid, String loginpwd, String name, String phone) {
        this.loginid = loginid;
        this.loginpwd = loginpwd;
        this.name = name;
        this.phone = phone;
    }

    public User(int id, String loginid, String loginpwd, String name, String phone) {
        this.id = id;
        this.loginid = loginid;
        this.loginpwd = loginpwd;
        this.name = name;
        this.phone = phone;
    }


    @Id
    @GeneratedValue
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column(name = "loginid")
    public String getLoginid() {
        return loginid;
    }

    public void setLoginid(String loginid) {
        this.loginid = loginid;
    }

    @Column(name = "loginpwd")
    public String getLoginpwd() {
        return loginpwd;
    }

    public void setLoginpwd(String loginpwd) {
        this.loginpwd = loginpwd;
    }

    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "phone")
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    @JoinColumn(name = "ouid")
    public Set<Order> getOrderSet() {
        return orderSet;
    }

    public void setOrderSet(Set<Order> orderSet) {
        this.orderSet = orderSet;
    }
}

